<!doctype HTML public "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- Click to Convert 5.2: Anything to HTML -->
<!-- http://www.clicktoconvert.com -->

<html>
<head>
<title>gravityboxscheduleuserguide - page 65 of 234</title>
<meta http-equiv=content-type content=text/html;charset=iso-8859-1>
<meta name="Generator" content="Click to Convert">

<!--Start of page styles-->
<STYLE TYPE="text/css">
<!--
 /* Foreground Image Styles */

 /* Position Styles */
 .ts65p0{position:absolute;left:106px;top:97px;}
 .ts65p1{position:absolute;left:352px;top:97px;}
 .ts65p3{position:absolute;left:672px;top:97px;}
 .ts65p7{position:absolute;left:106px;top:113px;}
 .ts65p8{position:absolute;left:706px;top:1026px;}
 .ts65p9{position:absolute;left:331px;top:1044px;}
 .ts65p13{position:absolute;left:106px;top:147px;}
 .ts65p15{position:absolute;left:106px;top:165px;}
 .ts65p16{position:absolute;left:106px;top:183px;}
 .ts65p18{position:absolute;left:106px;top:202px;}
 .ts65p19{position:absolute;left:106px;top:220px;}
 .ts65p20{position:absolute;left:154px;top:220px;}
 .ts65p22{position:absolute;left:106px;top:239px;}
 .ts65p23{position:absolute;left:106px;top:257px;}
 .ts65p26{position:absolute;left:106px;top:275px;}
 .ts65p30{position:absolute;left:106px;top:294px;}
 .ts65p31{position:absolute;left:106px;top:312px;}
 .ts65p32{position:absolute;left:106px;top:330px;}
 .ts65p34{position:absolute;left:106px;top:349px;}
 .ts65p36{position:absolute;left:106px;top:367px;}
 .ts65p37{position:absolute;left:106px;top:387px;}
 .ts65p39{position:absolute;left:106px;top:405px;}
 .ts65p40{position:absolute;left:106px;top:423px;}
 .ts65p42{position:absolute;left:106px;top:441px;}
 .ts65p44{position:absolute;left:106px;top:459px;}
 .ts65p46{position:absolute;left:106px;top:477px;}
 .ts65p48{position:absolute;left:106px;top:495px;}
 .ts65p50{position:absolute;left:106px;top:514px;}
 .ts65p51{position:absolute;left:106px;top:532px;}
 .ts65p53{position:absolute;left:106px;top:550px;}
 .ts65p56{position:absolute;left:106px;top:568px;}
 .ts65p58{position:absolute;left:106px;top:586px;}
 .ts65p60{position:absolute;left:106px;top:604px;}
 .ts65p62{position:absolute;left:106px;top:622px;}
 .ts65p64{position:absolute;left:106px;top:640px;}
 .ts65p66{position:absolute;left:106px;top:659px;}
 .ts65p68{position:absolute;left:106px;top:677px;}
 .ts65p70{position:absolute;left:106px;top:695px;}
 .ts65p73{position:absolute;left:106px;top:713px;}
 .ts65p75{position:absolute;left:106px;top:731px;}
 .ts65p77{position:absolute;left:106px;top:749px;}
 .ts65p79{position:absolute;left:106px;top:767px;}
 .ts65p82{position:absolute;left:106px;top:785px;}
 .ts65p85{position:absolute;left:106px;top:804px;}
 .ts65p87{position:absolute;left:106px;top:822px;}
 .ts65p89{position:absolute;left:106px;top:840px;}
 .ts65p91{position:absolute;left:106px;top:858px;}
 .ts65p93{position:absolute;left:106px;top:876px;}
 .ts65p95{position:absolute;left:106px;top:894px;}
 .ts65p97{position:absolute;left:106px;top:912px;}
 .ts65p100{position:absolute;left:106px;top:930px;}
 .ts65p104{position:absolute;left:106px;top:949px;}
 .ts65p106{position:absolute;left:106px;top:967px;}
 .ts65p108{position:absolute;left:106px;top:985px;}

 /* Font Styles */
 .ft0p65{font-style:normal;font-weight:bold;font-size:13px;font-family:arial,sans-serif;color:#000000;}
 .ft1p65{font-weight:normal;}
 .ft2p65{font-style:normal;font-weight:normal;font-size:13px;font-family:"times new roman","times new roman",times,serif;color:#000000;}
 .ft3p65{font-style:normal;font-weight:normal;font-size:16px;font-family:"times new roman","times new roman",times,serif;color:#000000;}
 .ft4p65{font-style:normal;font-weight:bold;font-size:11px;font-family:arial,sans-serif;color:#000000;}
 .ft5p65{font-style:normal;font-weight:normal;font-size:16px;font-family:"courier new",courier,monospace;color:#000000;}
 .ft6p65{font-family:arial,sans-serif;}
 .ft7p65{font-style:normal;font-weight:normal;font-size:16px;font-family:arial,sans-serif;color:#000000;}

 /* Background Style */
 .styleBackground65{position:absolute;left:97px;top:145px}

 /* Navigation Styles */
 .styleNavBarTop{position:absolute;left:0px;top:2px}
 .nb{position:absolute;left:2px;top:0px}
 .nbs{position:absolute;left:0px;top:0px}
 .nbe{position:absolute;left:836px;top:0px}
 .styleNavBarBot{position:absolute;left:0px;top:1117px}
-->
</STYLE>
<!--End of page styles-->

</head>
<body bgcolor="#ffffff" text="#000000" link="#0000FF" Vlink="#660099">

<table id="pageTable" width="836" STYLE="position: relative; left: auto; top: auto;"><tr><td>
<div class=nbs><img src="./navbarstart.gif" width="2" height="30"></div>
<div class=nb><img src="./navbar.gif" width="836" height="30" alt="Navigation bar"></div>
<div class=nbe><img src="./navbarend.gif" width="2" height="30"></div>
<div class=styleNavBarTop>
<table width="834" height="26" border="0" cellspacing="0">
  <tr align="left">
    <td width="4">&nbsp;</td>
    <td width="25" align="center"><a href="http://www.gravitybox.com" target="_parent"><img src="./home.gif" border="0" alt="Home"></a></td>
    <td width="25" align="center"><a href="#" onClick="window.open('./print.html','Printing','width=300,height=100,toolbar=no,directories=no');return false;"><img src="./print.gif" border="0" alt="Print document"></a></td>
    <td width="10" align="center"><img src="./separator.gif" border="0"></td>
    <td width="18" align="center"><a href="./index1.html"><img src="./start.gif" width="18" height="14" border="0" alt="Start"></a></td>
    <td width="18" align="center"><a href="./index64.html"><img src="./back.gif" width="14" height="14" border="0" alt="Previous page"></a></td>
    <td width="80" valign="middle"><table width="100%" height="16" border="0" cellspacing="1" bgcolor="#ACA899"><tr><td align="center" bgcolor="#ffffff"><font face=verdana,arial,sans-serif><font size="1">&nbsp;65 of 234&nbsp;</font></font></td></tr></table></td>
    <td width="18" align="center"><a href="./index66.html"><img src="./forward.gif" width="14" height="14" border="0" alt="Next page"></a></td>
    <td width="18" align="center"><a href="./index234.html"><img src="./end.gif" width="18" height="14" border="0" alt="End"></a></td>
    <td width="620">&nbsp;</td>
  </tr>
</table>
<p>
</div>
<nobr>
<div class=styleBackground65><img src="./background65.png" width="633" height="910" border="0" alt=""></div>
<div class=ts65p0><span class="ft0p65"> </span></div>
<div class=ts65p1><span class="ft0p65">Gravitybox Schedule Primer<span class="ft1p65"> </span></span></div>
<div class=ts65p3><span class="ft0p65">Page 63&nbsp; </span></div>
<div class=ts65p7><span class="ft2p65"> </span></div>
<div class=ts65p8><span class="ft3p65"> </span></div>
<div class=ts65p9><span class="ft4p65">1998&#45;2004 Gravitybox Software LLC<span class="ft3p65"> </span></span></div>
<div class=ts65p13><span class="ft5p65">&nbsp; Next i </span></div>
<div class=ts65p15><span class="ft5p65"> </span></div>
<div class=ts65p16><span class="ft5p65">End Sub<span class="ft6p65"> </span></span></div>
<div class=ts65p18><span class="ft7p65"> </span></div>
<div class=ts65p19><span class="ft7p65"> </span></div>
<div class=ts65p20><span class="ft7p65">The &#147;SaveForm&#148; method will save the configuration the user has specified. It </span></div>
<div class=ts65p22><span class="ft7p65">loops through the Rooms collection, to determine if the room has a database entry. If it </span></div>
<div class=ts65p23><span class="ft7p65">does its &#147;Id&#148; property is non&#45;zero. On load from the database, each room has its unique </span></div>
<div class=ts65p26><span class="ft7p65">non&#45;zero number stored in its &#147;Id&#148; property. If the room was added in this session of the </span></div>
<div class=ts65p30><span class="ft7p65">configuration, it has not been saved to the database yet. If there is no database record </span></div>
<div class=ts65p31><span class="ft7p65">then one must be created. It there is a record then the record must be updated. After </span></div>
<div class=ts65p32><span class="ft7p65">the save have been performed, we loop through the deleted array and remove all of </span></div>
<div class=ts65p34><span class="ft7p65">these room entries from the database. </span></div>
<div class=ts65p36><span class="ft7p65"> </span></div>
<div class=ts65p37><span class="ft5p65">Private Sub SaveForm() </span></div>
<div class=ts65p39><span class="ft5p65"> </span></div>
<div class=ts65p40><span class="ft5p65">Dim i As Integer </span></div>
<div class=ts65p42><span class="ft5p65">Dim NewEl As CItemEl </span></div>
<div class=ts65p44><span class="ft5p65">Dim Db As ADODB.Connection </span></div>
<div class=ts65p46><span class="ft5p65">Dim sSql As String </span></div>
<div class=ts65p48><span class="ft5p65">Dim oRoom As CRoomEl </span></div>
<div class=ts65p50><span class="ft5p65"> </span></div>
<div class=ts65p51><span class="ft5p65">&nbsp; Set Db = New ADODB.Connection </span></div>
<div class=ts65p53><span class="ft5p65">&nbsp; Db.ConnectionString = GetConnectString &#38; _ </span></div>
<div class=ts65p56><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AppPath &#38; &#34;schedule.mdb&#34; </span></div>
<div class=ts65p58><span class="ft5p65">&nbsp; Call Db.Open </span></div>
<div class=ts65p60><span class="ft5p65">&nbsp;&nbsp; </span></div>
<div class=ts65p62><span class="ft5p65">&nbsp; For Each oRoom In Rooms </span></div>
<div class=ts65p64><span class="ft5p65">&nbsp;&nbsp;&nbsp; If oRoom.Id = 0 Then </span></div>
<div class=ts65p66><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sSql = &#34;insert into [Room] (Name, SortOrder) &#34; &#38; _ </span></div>
<div class=ts65p68><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;values ('&#34; &#38; DoubleChar(oRoom.Name, &#34;'&#34;) &#38; _ </span></div>
<div class=ts65p70><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;', &#34; &#38; i &#38; &#34;)&#34; </span></div>
<div class=ts65p73><span class="ft5p65">&nbsp;&nbsp;&nbsp; Else </span></div>
<div class=ts65p75><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sSql = &#34;update [Room] set Name ='&#34; &#38; _ </span></div>
<div class=ts65p77><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DoubleChar(oRoom.Name, &#34;'&#34;) &#38; _ </span></div>
<div class=ts65p79><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;', SortOrder=&#34; &#38; i &#38; _ </span></div>
<div class=ts65p82><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34; where RoomId = &#34; &#38; oRoom.Id </span></div>
<div class=ts65p85><span class="ft5p65">&nbsp;&nbsp;&nbsp; End If </span></div>
<div class=ts65p87><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp; </span></div>
<div class=ts65p89><span class="ft5p65">&nbsp;&nbsp;&nbsp; Call Db.Execute(sSql) </span></div>
<div class=ts65p91><span class="ft5p65">&nbsp;&nbsp; </span></div>
<div class=ts65p93><span class="ft5p65">&nbsp; Next i </span></div>
<div class=ts65p95><span class="ft5p65">&nbsp;&nbsp; </span></div>
<div class=ts65p97><span class="ft5p65">&nbsp; 'Delete all the one we removed in this session </span></div>
<div class=ts65p100><span class="ft5p65">&nbsp; For i = 0 To UBound(arrDeleted) &#45; 1 </span></div>
<div class=ts65p104><span class="ft5p65">&nbsp;&nbsp;&nbsp; sSql = &#34;delete from [Room] &#34; &#38; _ </span></div>
<div class=ts65p106><span class="ft5p65">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#34;where RoomId = &#34; &#38; arrDeleted(i) </span></div>
<div class=ts65p108><span class="ft5p65">&nbsp;&nbsp;&nbsp; Call Db.Execute(sSql) </span></div>
<div class=styleNavBarBot>
<table width="836" border="0" cellspacing="2">
  <tr></tr>
  <tr>
    <td width="118"><a href="http://www.purepage.com"><img src="./smalllogo.gif" width="118" height="46" border="0" alt="http://www.purepage.com"></a></td>
    <td></td>
  </tr>
</table>
</div>

</td></tr></table>

</body>
</html>
